# -*-coding:utf-8-*-
"""
@project: python-project
@Time: 2024-07-12 14:24
@Author: Loneliness_Burial
@File: FirstStudy.py
@Motto: 深情不改必坠死海
@software: pycharm
@version: python 3.7
"""

import numpy as np

"""
    使用numpy做数据归一化
"""
url = 'https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data'
wid = np.genfromtxt(url, delimiter=',', dtype='float', usecols=[1])
# print(wid)
# print(wid.shape)
smax = np.max(wid)
smin = np.min(wid)

np.set_printoptions(precision=3)
# s = (wid - smin) / (smax - smin)
# print(s)

s = (wid - smin) / wid.ptp()
print(s)
